package com.china.jzf.springbootfirstapplication1;

import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class SpringbootFirstApplication1Application {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootFirstApplication1Application.class, args);
    }

    @Bean
    public CommandLineRunner commandLineRunner(ApplicationContext ctx)
    {
       return args->{
           System.out.println("Let's inspect the beans provided by Spring Boot-CONTROLLER:");
           String [] beanNames=ctx.getBeanDefinitionNames();
           for(int i=0;i<beanNames.length;i++)
           {
               System.out.println(beanNames[i]);
           }
        };
    }
}
